<!DOCTYPE html>
<html>
<head>
	<meta charset="utf-8" />
	<meta name="viewport" content="width=device-width, initial-scale=1.0">
    <meta name="description" content="">
    <meta name="author" content="">
	<title>
		<?php echo $title_for_layout; ?>
	</title>

	<?php

		echo $this->Html->css('bootstrap.min');
		echo $this->Html->css('main');

		echo $this->Html->script('jquery-1.9.1');
    	echo $this->Html->script('bootstrap.min');


    	echo $this->Html->script('jquery.simplyscroll');
    	echo $this->Html->css('jquery.simplyscroll');

		echo $this->fetch('meta');
		echo $this->fetch('css');
		echo $this->fetch('script');
	?>

	<script type="text/javascript">
	(function($) {
		$(function() {
			$("#scroller").simplyScroll({autoMode: 'bounce'});
			
			setWidthMobile();
		});
	})(jQuery);
	
	function setWidthMobile(){
        var width =  $(window ).width();
        var $main = $('.main');
        if(width <= 1160) {
            $main.removeClass('full');
        } else {
			$main.addClass('full');
		}
    }
	</script>
</head>

<body onresize="setWidthMobile()">


<!-- Head -->
<div class="header">
	<div class="row">
		<!-- Left -->
		<div class="col-xs-2 col-sm-2 col-md-2 header-left"> <a href="<?= $this->webroot; ?>"><img src="<?= $this->webroot; ?>img/logo.jpg" /> </a></div>
		<!-- End Left -->

		<!-- Right -->
		<div class="col-xs-10 col-sm-10 col-md-10 header-right">
			<div class="row">
				<div class="col-xs-12 col-sm-12 col-md-12">
					<ul class="top clearfix">
						<li <?= $controller == 'contacts' ? 'class="active"' : '' ?>><a href="<?= $this->webroot.'contact'; ?>">Liên Hệ</a></li>
						<li>|</li>
						<li <?= $controller == 'abouts' ? 'class="active"' : '' ?>><a href="<?= $this->webroot.'about'; ?>">Giới Thiệu</a></li>
					</ul>
				</div>
				<div class="col-xs-12 col-sm-12 col-md-12">
					<ul class="bottom clearfix">
						<li <?= $controller == 'news' ? 'class="active"' : '' ?>><a href="<?= $this->webroot.'news'; ?>">Tin Tức</a></li>

						<?php foreach($menus as $mn): ?>
			            <li <?php echo isset($cate_id) && $cate_id == $mn['Category']['id'] ? 'class="active"' : ''?> >
			            	<a href="<?= $this->webroot; ?>categories/lists/<?= $mn['Category']['id'] ?>"><?php echo $mn['Category']['name'];?></a>
			            </li>
			            <?php endforeach; ?>
					</ul>
				</div>
			</div>
		</div>
	</div>
	<!-- End Right -->
</div>
<div class="line"></div>
<!-- End Head -->

<!-- Body -->
<div class="main <?php echo $controller === 'homes' && $action === 'index' ? ' full' : ''?>"> <!-- full:  -->


	<?php echo $this->fetch('content'); ?>


</div>

<div class="clearfix"></div>
<div class="line "></div>
<!-- End body -->

<!-- Footer -->
<?php if( count($doitac) > 0):?>
<div class="footer-sub">
	<div class="row">
		<div class="col-xs-12 col-sm-12 col-md-12">
			<h3>Đối Tác</h3>
			<ul id="scroller">
				<?php foreach($doitac as $img):?>
				<li><a href="#"><img src="<?= PUBLIC_THUMB_SHOW. $img['Image']['image'] ?>" alt=""></a></li>
				<?php endforeach; ?>
			</ul>
		</div>
	</div>
</div>
<?php endif; ?>
<!-- End Footer -->

<!-- Footer -->
<div class="footer">
	<div class="row">
		<div class="col-xs-12 col-sm-12 col-md-12">
			<?php foreach($fmenus as $mn): ?>
       		<div class="item">
				<h4><a href="<?= $this->webroot.'categories/lists/'.$mn['Category']['id']; ?>"><?= $mn['Category']['name']?></a></h4>
				<?php if( !empty($mn['Category']['childs']) ):?>
				<ul>
					<?php foreach($mn['Category']['childs'] as $c ):?>
					<li> <a href="<?= $this->webroot.'products/lists/'.$c['Category']['id']; ?>"> <?= $c['Category']['name'] ?> </a> </li>
					<?php endforeach; ?>
				</ul>
				<?php endif; ?>
			</div>
            <?php endforeach; ?>
			</div>
		</div>
	</div>
</div>

<center>
	<p style="margin-bottom:30px;"><small>SPACE PLUS is a division of The Sliding Door Company® | Copyright © 2014. All Rights Reserved.</small></p>
</center>
<!-- End Footer -->

</body>
</html>
